// ViewSap.cpp : implementation file
//

#include "stdafx.h"
#include "TestAnaly.h"
#include "ViewSap.h"

#include "MainFrm.h"

#include "DD_AnalyCfg.h"
#include "DDErrorDefine.h"

/////////////////////////////////////////////////////////////////////////////
// ViewSap

IMPLEMENT_DYNCREATE(ViewSap, MyFormView)

ViewSap::ViewSap()
	: MyFormView()
{
	//{{AFX_DATA_INIT(ViewSap)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT

}

ViewSap::~ViewSap()
{
}

void ViewSap::DoDataExchange(CDataExchange* pDX)
{
	MyFormView::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(ViewSap)
		// NOTE: the ClassWizard will add DDX and DDV calls here
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(ViewSap, MyFormView)
	//{{AFX_MSG_MAP(ViewSap)
		// NOTE - the ClassWizard will add and remove mapping macros here.
	//}}AFX_MSG_MAP
	ON_WM_MOUSEMOVE()
	ON_WM_LBUTTONDOWN()
	ON_WM_LBUTTONUP()
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// ViewSap diagnostics

#ifdef _DEBUG
void ViewSap::AssertValid() const
{
	MyFormView::AssertValid();
}

void ViewSap::Dump(CDumpContext& dc) const
{
	MyFormView::Dump(dc);
}
#endif //_DEBUG

void ViewSap::Initialize()
{
    g_ImgAnaly.SetHwnd( eAnalyWindow_Sap,m_hWnd );
}



/////////////////////////////////////////////////////////////////////////////
// ViewSap message handlers

void ViewSap::OnDraw(CDC* /*pDC*/)
{
	// TODO: Add your specialized code here and/or call the base class
	if( !m_bInit )
	{
		return;
	}

	DDOnDraw();
}

void ViewSap::DDOnDraw()
{
	POINT tScrollPos     = (POINT)GetScrollPosition();

	zkImgDraw xImgDraw;
	xImgDraw.nScrollx    = tScrollPos.x;
	xImgDraw.nScrolly    = tScrollPos.y;
	xImgDraw.fZoomFactor = m_fZoomFactor;

	g_ImgAnaly.Draw(eAnalyWindow_Sap,&xImgDraw);

}





int ViewSap::CB_OnDrawMarkFun(HDC hDc,int nWidth,int nHeight,DWORD dwDispType,void *pContext)
{
	ViewSap *pView = (ViewSap*)pContext;
	return pView->DXOnDraw(hDc,nWidth,nHeight,dwDispType);
}




void ViewSap::OnMouseMove(UINT nFlags, CPoint point)
{
	// TODO: Add your message handler code here and/or call default
	CPoint Pt = point;
	GetImageXY(Pt);

	if( IsInside( Pt.x,Pt.y ) )
	{
		
	}

	MyFormView::OnMouseMove(nFlags, point);
}
void ViewSap::OnLButtonDown(UINT nFlags, CPoint point)
{
	// TODO: Add your message handler code here and/or call default
	CPoint Pt = point;
	GetImageXY( Pt );
	if( IsInside( Pt.x,Pt.y ) )
	{
		
	}

	SetCapture(); 

	MyFormView::OnLButtonDown(nFlags, point);
}

void ViewSap::OnLButtonUp(UINT nFlags, CPoint point)
{
	// TODO: Add your message handler code here and/or call default

	CPoint Pt = point;
	GetImageXY(Pt);

	if( IsInside( Pt.x,Pt.y ) )
	{	
		
	}


	ReleaseCapture();

	MyFormView::OnLButtonUp(nFlags, point);
}




int ViewSap::DXOnDraw(HDC hDc,int nWidth,int nHeight,DWORD dwDispType)
{
	

	return 0;
}

